<template>
    <el-container>
        <el-header>
            <div class="left-panel">
                <div class="right-panel-search">
                    <el-input v-model="search.keyword" placeholder="手机号" clearable></el-input>
                    <el-button type="primary" icon="el-icon-search" @click="upsearch"></el-button>
                </div>
            </div>
        </el-header>
        <el-main class="nopadding">
            <scTable ref="table" :apiObj="list.apiObj" :params="list.params" row-key="id" stripe>
                <el-table-column label="#ID" prop="id" width="50"></el-table-column>
                <el-table-column label="优惠劵名称" prop="coupon.title" width="150"></el-table-column>
                <el-table-column label="用户" prop="user.username" width="100"></el-table-column>
                <el-table-column label="手机号" prop="phone" width="110"></el-table-column>
                <el-table-column label="金额" prop="coupon.amount" width="100"></el-table-column>
                <el-table-column label="有效期" width="280">
                    <template #default="scope">
                        {{ scope.row.use_start_time + ' - ' + scope.row.use_end_time }}
                    </template>
                </el-table-column>
                <el-table-column label="状态" width="100">
                    <template #default="scope">
                        <el-tag type="success" v-if="scope.row.status == 1">未使用</el-tag>
                        <el-tag type="danger" v-else-if="scope.row.status == 2">已过期</el-tag>
                        <el-tag v-else-if="scope.row.status == 10">已使用</el-tag>
                    </template>
                </el-table-column>
                <el-table-column label="领取时间" prop="create_time" width="150"></el-table-column>
            </scTable>
        </el-main>
    </el-container>
</template>

<script>

export default {
    emits: ['closed'],
    name: 'couponIssueLogs',
    components: {

    },
    props: {
        coupon: {
            type: Object,
            default: null
        }
    },
    data () {
        return {
            list: {
                apiObj: this.$API.app.coupon.sendLog,
                params: {
                    coupon_id: this.coupon.id
                }
            },
            search: {
                keyword: null
            }
        }
    },
    mounted () {
        console.log(this.coupon)
    },
    methods: {
        //搜索
        upsearch () {
            this.$refs.table.upData(this.search);
        },
    }
}
</script>

<style></style>
